from cdsay.upimage.forms import imageForm
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from cdsay.upimage.models import modelImage

def viewImage(request):
    if request.method == 'POST':  
        if 'file' in request.FILES:
            image = request.FILES["file"]
        else:
            image=None
        m=modelImage(image)
        m.save()
        s=imageForm(image)
        s.image
        s.save()
        return HttpResponseRedirect('upfile')
    else:
        form = imageForm()
    return render_to_response('upimage.html', {'form': form})

    